package org.csu.mypetstore.api.vo;

import lombok.Data;

//聊天室使用人员
@Data
public class ChatUserVO {
    //暂定的头像
    public static String picture=
            "https://tse1-mm.cn.bing.net/th/id/R-C.cb9aa02f245d42d9b8895adc6c2b80bc?rik=v9wwwcQCuq995w&riu=http%3a%2f%2fscimg.jianbihuadq.com%2f202004%2f20200421202536133.jpg&ehk=Maiw4LLFQOElZCXfG27oot98q4KbS04xsm2IRK8Jm6U%3d&risl=&pid=ImgRaw&r=0&sres=1&sresct=1";

    private String id;              //ID（与username一致）
    private String displayName;     //展示的名字（与username一致）
    private String avatar;          //头像

    public ChatUserVO(){}

    public ChatUserVO(String id,String displayName,String avatar){
        this.id=id;
        this.displayName=displayName;
        this.avatar=avatar;
    }

    //将聊天室使用人员封装为聊天对象
    public ContactDataVO toContactDataVO(){
        ContactDataVO contactDataVO = new ContactDataVO();
        contactDataVO.setId(this.id);
        contactDataVO.setDisplayName(this.displayName);
//        contactDataVO.setAvatar(this.avatar);
        contactDataVO.setAvatar(picture);
        contactDataVO.setIndex(this.displayName.substring(0,1).toUpperCase());
        contactDataVO.setUnread(0);
        contactDataVO.setLastSendTime(null);
        contactDataVO.setLastContent("");
        return contactDataVO;
    }
}
